{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('storelist',array('type'=>all));}">全部商家</a></li>
</ul>
<br>
<div class="row ygrow">
    <div class="col-lg-12">
        <form action="" method="get" class="col-md-4">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="yzzc_sun" />
            <input type="hidden" name="do" value="storelist" />
            <div class="input-group">
                <input type="text" name="keywords" class="form-control" placeholder="请输入商家名称">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </form>

        <div class="col-md-4">
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div>

<!--<div class="row ygrow">-->
<!--    <div class='col-lg-12'>-->
<!--        <a  href="{php echo $this->createWebUrl('storelist',array('op'=>add));}"><button class="btn btn-sm store-blue">添加商家</button></a>-->
<!--    </div>-->
<!--</div>-->
<div class="main ">

    <div class="panel panel-default">
        <div class="panel-heading">
            门店列表
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row" id="accordion">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
<!--                        <td  class="store_td1 col-md-1">编号</td>-->
                        <td  class="store_td1 ">姓名</td>
                        <td  class="">电话</td>
                        <td  class="">总结算金额</td>
                        <td  class="">提现总金额</td>
                        <td  class="">余额</td>
                        <td class="">冻结余额</td>
                        <td class="">交易手续费</td>
                        <td class="">提现手续费</td>
                        <td class="">状态</td>
                        <td>操作</td>
                    </tr>

                    {loop $info $key $item}
                    <tbody>
                    <tr class="yg5_tr2" >
                        <td>{$item['name']}</td>
                        <td>{$item['mobile']}</td>
                        <td>{$item['billing_amount']}</td>
                        <td>{$item['payout_amount']}</td>
                        <td>{$item['balance']}</td>
                        <td>{$item['freezing_balance']}</td>
                        <td>{$item['platform_fee']}</td>
                        <td>{$item['payout_fee']}</td>
                        <td>
                            {if $item['is_disable']==1}
                            <span class="label store-green btn">正常</span>
                            {else}
                            <span class="label store-red btn">冻结</span>
                            {/if}
                        </td>
                        <td>
                            {if $item['is_disable'] == 1}
                            <a href="javascript:void(0);" onclick="isDisable({$item['store_id']},0)">
                                <span class="btn btn-md store-red btn-xs">冻结</span>
                            </a>
                            {/if}
                            {if $item['is_disable'] == 0}
                            <a href="javascript:void(0);" onclick="isDisable({$item['store_id']},1)" class="storespan btn btn-xs" >
                                <span class="btn btn-md btn-xs store-green">解除冻结</span>
                            </a>
                            {/if}
                            <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#fee{$item['store_id']}">
                                <span class="btn btn-md ygyouhui2 btn-xs">设置</span>
                            </a>
                            <a href="/web/index.php?c=site&a=entry&do=store_personal&store_id={$item['store_id']}&module_name=yzzc_sun&version_id=1&op=income" class="storespan btn btn-xs" >
                                <span class="btn btn-md ygyouhui2 btn-xs">收益列表</span>
                            </a>
<!--                            <a href="javascript:;" class="storespan btn btn-xs" onclick="del({$item['store_id']})">-->
<!--                                <span class="fa fa-trash-o"></span><span class="bianji">删除<span class="arrowdown"></span></span>-->
<!--                            </a>-->
                        </td>
                    </tr>
                    </tbody>
                    <div class="modal fade " id="fee{$item['store_id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog we7-modal-dialog modal-dialog we7-form" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="fee" style="font-size: 20px;">手续费设置</h4>
                                </div>
                                <form action="" method="get" >
                                    <input type="hidden" name="c" value="site" />
                                    <input type="hidden" name="a" value="entry" />
                                    <input type="hidden" name="m" value="yzzc_sun" />
                                    <input type="hidden" name="do" value="store_personal" />
                                    <input type="hidden" name="id" value="{$item['store_id']}" />
                                    <input type="hidden" name="op" value="change" />
                                    <div class="modal-body" style="font-size: 20px">
                                        <div class="form-group" >
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">交易手续费</label>
                                            <div class="col-sm-10">
                                                <input name="platform_fee" type="text"  class="form-control" placeholder="请输入外调车型名称" value="{$item['platform_fee']}" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">提现手续费</label>
                                            <div class="col-sm-10">
                                                <input name="payout_fee" type="text"  class="form-control" value="{$item['payout_fee']}" placeholder="请输入外调车牌号" />
                                            </div>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <input type="submit" class="btn btn-info" name="submit" value="确定"/>
                                    </div>
                                    <input type="hidden" name="token" value="{$_W['token']}"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    {/loop}
                    {if empty($item)}
                    <tr class="yg5_tr2">
                        <td colspan="8">
                            暂无地址信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </div>

    </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-16").show();
        $("#yframe-16").addClass("wyactive");
    })
    function del(id) {
        var ret = confirm("删除前请确认该门店所有车辆均已下架，您确定删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=store_personal&op=delete&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    if(res.type == 'success') {
                        location.reload();
                    }else{
                        alert('删除失败');
                    }
                }
            })
        }
    }
    function isDisable(id,status) {
        var ret = ''
        if (status == 0){
            ret = confirm("您确定禁用吗？")
        }else {
            ret = confirm("您确定解除禁用吗？")
        }
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=store_personal&op=disable&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id,is_disable:status},
                success:function(res){
                    if(res.type == 'success') {
                        location.reload();
                    }else{
                        alert('操作失败');
                    }
                }
            })
        }
    }

</script>